package cn.stylefeng.guns.sys.modular.system.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.sys.modular.system.entity.MeiTuan;
import cn.stylefeng.guns.sys.modular.system.mapper.MeiTuanMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

@Service
public class MeiTuanService extends ServiceImpl<MeiTuanMapper, MeiTuan> {

    /**
     * 判断是否存在此妖号
     */
    public String judge(String yaoMa) {
        return this.baseMapper.judge(yaoMa);
    }

    /**
     * 新增数据
     */
    public int insertMeiTuan(MeiTuan meiTuan) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        meiTuan.setSj(sdf.format(new Date()));
        meiTuan.setPt("1");
        return this.baseMapper.insert(meiTuan);
    }
    public Page<Map<String, Object>> list(String condition, String sjh,String ym) {
        Page page = LayuiPageFactory.defaultPage();

        return this.baseMapper.list(page, condition,sjh,ym);
    }
}
